<template>
  <div class="dashboard-container">
    <div>
      <!-- <svg-icon icon-class="eye-open" class-name="eye-cls" /> -->
      <h2>动态组件</h2>
      <hr>
      <button @click="handleClick">切换</button>
      <component :is="currentCom" v-bind="obj">hello</component>
    </div>
  </div>
</template>

<script>
import MyTestA from './components/MyTestA.vue'
import MyTestB from './components/MyTestB.vue'

export default {
  name: 'Dashboard',
  components: { MyTestA, MyTestB },
  data () {
    return {
      currentCom: 'MyTestA',
      obj: {
        info: 'hello',
        msg: 'nihao'
      }
    }
  },
  methods: {
    handleClick () {
      // this.currentCom = 'MyTestB'
      this.currentCom = 'a'
    }
  }
}
</script>

<style lang="scss" scoped>
.eye-cls {
  color: blue;
}
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
